# mac上修改/etc/hosts文件
host.add() {
    if [ $# = 0 ]; then
        echo "#### 使用方法: host.add banli.site 127.0.0.1"
        return
    fi
    domain=$1
    ip=$2
    if [ $# = 1 ]; then
        ip=127.0.0.1
    fi
    echo "$ip $domain" | sudo tee -a /etc/hosts
}

host.del() {
    if [ $# != 1 ]; then
        echo "#### 使用方法: host.del banli.site"
        return
    fi
    domain=$1
    sudo sed -i '' "/$domain/d" /etc/hosts
}

host.cat() {
    cat /etc/hosts
}
